package exercise;

import java.util.*;

public class ss {
    public static void main(String[] args) {
        String[] s = new String[]{"A", "B", "C", "D","E"};
        List<String> list = Arrays.asList(s);
        //array转set

//List转Set
        Set<String> set = new HashSet<>(list);
        System.out.println("set: " + set);
//Set转List
        List<String> list_1 = new ArrayList<>(set);
        System.out.println("list_1: " + list_1);
        s = new String[]{"A", "B", "C", "D","E"};
        set = new HashSet<>(Arrays.asList(s));
        System.out.println("set: " + set);
//set转array
        String[] dest = set.toArray(new String[0]);
        System.out.println("dest: " + Arrays.toString(dest));
    }

}
